package com.yijiajiao.finance.controller;


import com.yijiajiao.finance.bean.IOSMoneyBean;
import com.yijiajiao.finance.bean.ResultBean;
import com.yijiajiao.finance.service.IOSMoneyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @AUTHOR zhaoming@eduspace
 * @CREATE 2017-02-14-11:41
 */

@RestController
@RequestMapping("/ios")
public class IOSMoneyController {

    @Autowired
    private IOSMoneyService iosMoneyService;

    /**
     * 查询余额
     */
    @GetMapping( "remainMoney" )
    public ResultBean queryRemainMoney(String openId){
        return iosMoneyService.queryRemainMoney(openId);
    }

    /**
     * 充值
     */
    @PostMapping( "/addMoney" )
    public ResultBean addIOSMoney(@RequestBody IOSMoneyBean IOSMoneyBean){
        return iosMoneyService.addIOSMoney(IOSMoneyBean);
    }

    /**
     * 消费余额
     */
    @PostMapping( "/consumeMoney" )
    public ResultBean consumeMoney(@RequestBody IOSMoneyBean iosMoneyBean){
        return iosMoneyService.consumeMoney(iosMoneyBean);
    }

    /**
     * 查询交易记录 1充值记录；0消费记录 不传查所有
     */
    @GetMapping( "transList" )
    public ResultBean transList(String openId, Integer type, int pageNo, int pageSize){
        return iosMoneyService.transList(openId,type,pageNo,pageSize);
    }

    /**
     * 批量删除记录 ids由多个id通过","拼接
     */
    @GetMapping( "/delByIds" )
    public ResultBean delByIds(String ids){
        return iosMoneyService.delByIds(ids);
    }

}
